package com.example.demo1.service.servicelmpl;

import com.example.demo1.repository.PictureDao;
import com.example.demo1.service.IndividualService;
import com.example.demo1.utils.AliOSSUtils;
import com.example.demo1.utils.IndiExper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Transactional
@Service
public class IndividualServices implements IndividualService {
          @Autowired
        public PictureDao pictureDao;
          @Autowired
          public AliOSSUtils aliOSSUtils;
          public List<IndiExper> list(String username){

              List<IndiExper> indiExpers =pictureDao.findByUsername(username);
              return indiExpers;

          }
           public void delete(IndiExper indiExper){
                aliOSSUtils.Delete(indiExper);
                pictureDao.deletePictureByExperimentNameAndPictureNameAndTeamName(indiExper.getExperiment_name(), indiExper.getPicture_name(), indiExper.getTeam_name());

           }
}
